package bavaria.hightech.zeit;

import java.awt.Font;
import java.awt.Graphics;
import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import javax.swing.JPanel;
import javax.swing.JFrame;
public class Clock extends JFrame{
	
	protected JPanel panel;
		
	 private static class ClockDisplay extends JPanel {
	        @Override
	        public void paintComponent(Graphics g) {
	            super.paintComponent(g);
	            Calendar cal = Zeitgeber.getCalendar();
	            Date date = cal.getTime();
	            DateFormat dateFormatter = DateFormat.getTimeInstance();
	            g.setFont(new Font(null,Font.PLAIN,20));
	            g.drawString(dateFormatter.format(date), 20, 50);
	            dateFormatter = DateFormat.getDateInstance();
	            g.drawString(dateFormatter.format(date), 10, 30);
	        }
	    }


	    public Clock() {
	        panel = new ClockDisplay();
	        add("Center", panel);
	        setDefaultCloseOperation(EXIT_ON_CLOSE);
	        setSize(100, 100);
	        setVisible(true);

	    }
}
